/*
 * @Author: NaturalHulk 2066634567@qq.com
 * @Date: 2024-10-08 09:31:44
 * @LastEditors: NaturalHulk 2066634567@qq.com
 * @LastEditTime: 2024-10-11 14:25:45
 * @FilePath: /xhs-mom-new/vite/plugins/index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import vue from '@vitejs/plugin-vue'

import createAutoImport from './auto-import'
import createSvgIcon from './svg-icon'
import createCompression from './compression'
import createSetupExtend from './setup-extend'
import visualizer from 'rollup-plugin-visualizer'
import MyPlugin from '../../plngin/MyPlugin.ts'
export default function createVitePlugins(viteEnv, isBuild = false) {
  const vitePlugins = [
    vue(),
    MyPlugin(),
    visualizer({
      open: true, //注意这里要设置为true，否则无效
      gzipSize: true,
      brotliSize: true
    })
  ]
  vitePlugins.push(createAutoImport())
  vitePlugins.push(createSetupExtend())
  vitePlugins.push(createSvgIcon(isBuild))
  isBuild && vitePlugins.push(...createCompression(viteEnv))
  return vitePlugins
}
